#include <iostream>

/*
 * Provide a unified interface to as set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem
 * easier to use. The pattern has structural purpose and applies to objects.
 * 
 * you want to provide a simple interface to a complex subsystem.
 * there are many dependencies between clients and the implementation classes of an abastraction
 * you want to layer your subsystems, use a facade to define an entry point to each subsystem level
 */

class SubsystemA
{
public:
    void suboperation()
    {
        std::cout << "Subsystem A method..." << std::endl;
    }
};

class SubsystemB
{
public:
    void suboperation()
    {
        std::cout << "Subsystem B method..." << std::endl;
    }
};

class SubsystemC
{
public:
    void suboperation()
    {
        std::cout << "Subsystem C method..." << std::endl;
    }
};

class Fadcade
{
public:
    Fadcade() : subsystem_a(), subsystem_b(), subsystem_c() {}

    void op1()
    {
        subsystem_a->suboperation();
        subsystem_b->suboperation();
    }

    void op2()
    {
        subsystem_c->suboperation();
    }

private:
    SubsystemA *subsystem_a;
    SubsystemB *subsystem_b;
    SubsystemC *subsystem_c;
};

int main()
{
    Fadcade *facade = new Fadcade();

    facade->op1();
    facade->op2();

    delete facade;

    return 0;
}